//
//  UUUserInfo.m
//  UUCharterSupplier
//
//  Created by ZhangAo on 24/01/2018.
//  Copyright © 2018 UUCharter. All rights reserved.
//

#import "UUUserInfo.h"

@implementation UUUserInfo

- (instancetype)init {
    self = [super init];
    if (self) {
        [self addManualMappingDict:@{
                                     @"id" : @"userId",
                                     @"vendorId" : @"supplierId"
                                     }];
    }
    return self;
}

#pragma - NSCoding methods

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super init];
    if (self) {
        self.userId = [aDecoder decodeObjectForKey:@"userId"];
        self.supplierId = [aDecoder decodeObjectForKey:@"supplierId"];
        self.cityId = [aDecoder decodeObjectForKey:@"cityId"];
        self.avatar = [aDecoder decodeObjectForKey:@"avatar"];
        self.company = [aDecoder decodeObjectForKey:@"company"];
        self.name = [aDecoder decodeObjectForKey:@"name"];
        self.roleId = [aDecoder decodeIntegerForKey:@"roleId"];
        self.freezeMoney = [aDecoder decodeObjectForKey:@"freezeMoney"];
        self.withdrawMoney = [aDecoder decodeObjectForKey:@"withdrawMoney"];
        self.status = [aDecoder decodeIntegerForKey:@"status"];
        self.receiveIntentOrder = [aDecoder decodeBoolForKey:@"receiveIntentOrder"];
        self.remark = [aDecoder decodeObjectForKey:@"remark"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [aCoder encodeObject:self.userId forKey:@"userId"];
    [aCoder encodeObject:self.supplierId forKey:@"supplierId"];
    [aCoder encodeObject:self.cityId forKey:@"cityId"];
    [aCoder encodeObject:self.avatar forKey:@"avatar"];
    [aCoder encodeObject:self.company forKey:@"company"];
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeInteger:self.roleId forKey:@"roleId"];
    [aCoder encodeObject:self.freezeMoney forKey:@"freezeMoney"];
    [aCoder encodeObject:self.withdrawMoney forKey:@"withdrawMoney"];
    [aCoder encodeInteger:self.status forKey:@"status"];
    [aCoder encodeBool:self.receiveIntentOrder forKey:@"receiveIntent"];
    [aCoder encodeObject:self.remark forKey:@"remark"];
}

@end
